package com.gs.cd.service.resource.mapper;

import com.gs.cd.model.resource.SysResourceGroup;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author seven
 * @since 2020-12-22
 */
public interface SysResourceGroupMapper extends BaseMapper<SysResourceGroup> {

    /**
     * 非mybatis id自增的添加
     *
     * @param list
     * @return
     */
    @Insert("<script>" +
            "insert into sys_resource_group(\"id\", \"parent_id\", \"name\", \"description\", " +
            "\"sort\", \"sale_code\", \"creator\", \"create_time\", \"updator\", " +
            "\"update_time\", \"code\", \"category\") values" +
            "<foreach collection='list' item='sysResourceGroup' separator=','>" +
            "(#{sysResourceGroup.id},#{sysResourceGroup.parentId},#{sysResourceGroup.name},#{sysResourceGroup.description}," +
            "#{sysResourceGroup.sort},#{sysResourceGroup.saleCode}," +
            "#{sysResourceGroup.creator},#{sysResourceGroup.createTime},#{sysResourceGroup.updator},#{sysResourceGroup.updateTime}," +
            "#{sysResourceGroup.code},#{sysResourceGroup.category})" +
            "</foreach>" +
            "</script>")
    int insertBatchNotAuto(@Param("list")List<SysResourceGroup> list);
}
